Conditional Statements and Loops in C Language
Conditional Statements and Loops in C Language: Overview
This topic covers concepts, such as Conditional Statements in C/C++, Loops and Iteration, If-else in C/C++, If statement in C/C++, For Loop, Syntax of For Loop, Test Expression in For Loop, Syntax of While Loop, Nested-if in C/C++, While Loop, etc.
Important Questions on Conditional Statements and Loops in C Language
The first expression in a for… loop is

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main() {
int n = 15;
for (; ;)
cout << n;
return 0;
}

If you have to make decision based on multiple choices, which of the following is best suited?

Identify the updated expression in the given for loop
for(int i = 0; i < n; i++){
}

What is the output of the following code:
void main()
{
int i;
for(i=65;i<70;i++)
printf(“%c,”,i);
}

int main()
{
int i=0;
for (i = 1; i <= 10; i++)
{
printf( "Hello World\n");
}
return 0;
}
Identify the test condition and how mony times the for loop will execute?

for(int i = 0; i < n; i++){
print(i);
}
Identify the initialisation expression in for loop.

What is the output of the following code:
void main()
{
int 5;
for(i=5;i<=15;i++)
printf(“%d\n”,i);
}

Types of loops are______

Syntax of If-else-if ladder in C/C++ is__________

What will be the output of the following C code?
#include <stdio.h>
int main(){
int a = 11;
while (a < 20) {
printf("%d ", a);
a += 2;
}
return 0;
}

Choose a correct C++ for loop syntax.

Nested if…else statement can be replaced by the statement of ___

Which of the following is valid syntax for creating a while loop?

Find the output of the given C program.
#include<stdio.h>
int main()
{
if(-5)
printf("a");
printf("b");
else
printf("c");
printf("d");
return 0;
}

What is the output of the C Program.?
int main()
{
if( 4 > 5 )
{
printf("Hurray..\n");
}
printf("Yes");
return 0;
}

Which loop is faster in C++ Language, for, while or do-while?

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main() {
if (0) {
cout << "Hello" ;
}
else
{
cout << "Good Bye" ;
}
return 0;
}

Decision Control statements in C++ can be implemented using

In a for loop, if the condition is missing, then
